package com.jrx.anytxn.transaction.service.impl;

import com.jrx.anytxn.common.data.TxnRespCode;
import com.jrx.anytxn.common.exception.TxnBizException;
import com.jrx.anytxn.common.uitl.DateUtils;
import com.jrx.anytxn.customer.dto.customer.CustomerRes;
import com.jrx.anytxn.customer.entity.CmCustomerAddressInfo;
import com.jrx.anytxn.customer.entity.CmCustomerBankcardInfo;
import com.jrx.anytxn.customer.entity.CmCustomerFirstLevel;
import com.jrx.anytxn.customer.entity.CmCustomerSecondLevel;
import com.jrx.anytxn.customer.mapper.ext.ExtCmCustomerAddressInfoMapper;
import com.jrx.anytxn.customer.mapper.ext.ExtCmCustomerBankcardInfoMapper;
import com.jrx.anytxn.customer.mapper.ext.ExtCmCustomerFirstLevelMapper;
import com.jrx.anytxn.customer.mapper.ext.ExtCmCustomerSecondLevelMapper;
import com.jrx.anytxn.customer.service.ICustomerService;
import com.jrx.anytxn.param.entity.PrInterestTable;
import com.jrx.anytxn.param.entity.PrProductTable;
import com.jrx.anytxn.param.service.product.IInterestTableService;
import com.jrx.anytxn.param.service.product.IProductTableService;
import com.jrx.anytxn.sharding.pojo.entity.CacheMapping;
import com.jrx.anytxn.sharding.service.ICacheMappingService;
import com.jrx.anytxn.transaction.constant.TransBizConstant;
import com.jrx.anytxn.transaction.dto.taiAnBank.*;
import com.jrx.anytxn.transaction.entity.AmLoanAccountInfo;
import com.jrx.anytxn.transaction.entity.AmLoanMainInfo;
import com.jrx.anytxn.transaction.entity.TlDisbursementLog;
import com.jrx.anytxn.transaction.entity.TlPaymentAllocationLog;
import com.jrx.anytxn.transaction.mapper.ext.ExtAmLoanAccountInfoMapper;
import com.jrx.anytxn.transaction.mapper.ext.ExtAmLoanMainInfoMapper;
import com.jrx.anytxn.transaction.mapper.ext.ExtTlDisbursementLogMapper;
import com.jrx.anytxn.transaction.mapper.ext.ExtTlPaymentAllocationLogMapper;
import com.jrx.anytxn.transaction.service.ITaiAnBankService;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

@Service
public class TaiAnBankServiceImpl implements ITaiAnBankService {

    private static final Logger logger = LoggerFactory.getLogger(TaiAnBankServiceImpl.class);

    @Resource
    private ExtAmLoanMainInfoMapper extAmLoanMainInfoMapper;
    @Resource
    private ExtAmLoanAccountInfoMapper extAmLoanAccountInfoMapper;
    @Autowired
    private IProductTableService productTableService;
    @Resource
    private ExtCmCustomerSecondLevelMapper extCmCustomerSecondLevelMapper;
    @Resource
    private ExtCmCustomerFirstLevelMapper extCmCustomerFirstLevelMapper;
    @Autowired
    private IInterestTableService interestTableService;
    @Resource
    private ExtTlDisbursementLogMapper extTlDisbursementLogMapper;
    @Resource
    private ExtCmCustomerBankcardInfoMapper extCmCustomerBankcardInfoMapper;
    @Resource
    private ExtTlPaymentAllocationLogMapper extTlPaymentAllocationLogMapper;
    @Autowired(required = false)
    private ICacheMappingService cacheMappingService;
    @Autowired
    private ICustomerService customerService;
    @Resource
    private ExtCmCustomerAddressInfoMapper extCmCustomerAddressInfoMapper;

    @Override
    public RepaymentHistoryRes repaymentHistoryQuery(RepaymentHistoryReq req) throws TxnBizException {
        RepaymentHistoryRes res = new RepaymentHistoryRes();
        //根据订单号查询
        AmLoanMainInfo amLoanMainInfo = extAmLoanMainInfoMapper.selectByLoanIdAndTenantId(req.getLoanId(),req.getTenantId());
        if(null == amLoanMainInfo){
            return null;
        }
        AmLoanAccountInfo amLoanAccountInfo = extAmLoanAccountInfoMapper.selectByLoanId(amLoanMainInfo.getLoanId()
                ,amLoanMainInfo.getCustomerId(),amLoanMainInfo.getTenantId());

        if(null == amLoanAccountInfo){
            return null;
        }

        //获取产品信息
        PrProductTable prProductTable = productTableService.findProByProIdAndOrgId(amLoanMainInfo.getProductId(),amLoanMainInfo.getOrganizationId(),
                amLoanMainInfo.getTenantId());
        //客户二级信息
        CmCustomerSecondLevel secondLevel = extCmCustomerSecondLevelMapper.selectByCustomerIdAndChannel(amLoanMainInfo.getCustomerId(),
                amLoanMainInfo.getChannel(),amLoanMainInfo.getTenantId());
        //客户一级信息
        CmCustomerFirstLevel firstLevel = extCmCustomerFirstLevelMapper.selectFirstLevelByOrgIdAndCusId(secondLevel.getCustomerId(),
                secondLevel.getOrganizationId(),secondLevel.getTenantId());
        //查询利率参数
        PrInterestTable prInterestTable = interestTableService.findInterestByInterestId(amLoanMainInfo.getInterestTableId(),amLoanMainInfo.getTenantId());
        //获取放款流水
        TlDisbursementLog tlDisbursementLog = extTlDisbursementLogMapper.selectDisbursementByCondition(amLoanMainInfo.getLoanId(),
                amLoanMainInfo.getCustomerId(),amLoanMainInfo.getTenantId());
        //获取默认扣款卡
        CmCustomerBankcardInfo bank = extCmCustomerBankcardInfoMapper.selectBankCardByCondition(
                amLoanMainInfo.getCustomerId(),TransBizConstant.Y_FLAG,null,amLoanMainInfo.getChannel(),amLoanMainInfo.getTenantId());
        //查询订单还款分配记录
        List<TlPaymentAllocationLog> PaymentAllocationList = extTlPaymentAllocationLogMapper.selectByLoanIdDesc(amLoanMainInfo.getLoanId(),
                amLoanMainInfo.getCustomerId(),amLoanMainInfo.getTenantId(),TransBizConstant.PAYMENT_ALLOCATION_TYPE_09);


        //借据号
        res.setLnAcctNo(amLoanMainInfo.getLoanId());
        //产品id
        res.setPdpCode(prProductTable.getProductId());
        //产品名称
        res.setPdpDesc(prProductTable.getChineseName());
        //营业机构中文名称
        res.setOpunChnName("泰安银行");
        //客户名称
        res.setCustName(firstLevel.getChineseName());
        //贷款资金来源 01:自营贷款 02:委贷
        res.setLnFundRsur("01");
        //客户编号
        res.setCustNo(firstLevel.getEcifId());
        //账户状态
        res.setAcctSts(account(amLoanAccountInfo.getAccountStatus()));
        //帐别
        res.setAcctTyp("101");
        //合同编号
        res.setCtrtNo(amLoanMainInfo.getLoanId());
        //业务别
        res.setBusnTyp("111");
        //贷款额度编号(手机号后四位)
        res.setCrlmtNo("");
        //开户日期
        res.setOpacDtN(DateUtils.format(amLoanMainInfo.getPostingDate(),DateUtils.DATE_PATTERN_ANOTHER));
        //到期日期
        res.setDueDtN(DateUtils.format(amLoanMainInfo.getLastPaymentDate(),DateUtils.DATE_PATTERN_ANOTHER));
        //结清时间
        String payOffDate = amLoanAccountInfo.getPayoffDate() == null ? "": DateUtils.formatDate(amLoanAccountInfo.getPayoffDate(),DateUtils.DATE_PATTERN_ANOTHER);
        res.setClsdDtN(payOffDate);
        //逾期日期
        res.setDlayLnDtN(amLoanAccountInfo.getDelqDays()+"");
        //利率
        res.setIntr(rate(prInterestTable.getBaseRate().divide(new BigDecimal(12),8,BigDecimal.ROUND_HALF_UP)));
        if("3".equals(req.getIntrTermUnit())){//年利率
            res.setIntr(rate(prInterestTable.getBaseRate().divide(new BigDecimal(1),8,BigDecimal.ROUND_HALF_UP)));
        }else{//月利率 现在暂时没有日利率
            res.setIntr(rate(prInterestTable.getBaseRate().divide(new BigDecimal(12),8,BigDecimal.ROUND_HALF_UP)));
        }
        //逾期利率
        res.setDlayIntr(rate(prInterestTable.getBaseRate().multiply(new BigDecimal(1.5))));
        //还款方式 01:期初付息,到期还本//02:期末本息一次付清//03:定期结息,到期还本//04:定期结息,按还款计划还本//13:等额本息还款//14:等额本金还款
        res.setRfnSty(paymet(amLoanMainInfo.getAmortMethodTableId()));
        //每月计息
        res.setPmnIntcCod("2");
        //还本周期单位
        res.setRopCyclUnit("M");
        //还本周期月数
        res.setRopCyclMnTotlN("1");
        //收息周期单位
        res.setColiCyclUnit("M");
        //收息周期月数
        res.setColiCyclTotlNmN("1");
        //利率调整方式
        res.setIntrAdjSty("0");
        //利率生效日期
        res.setIntrEffDtN(DateUtils.format(amLoanMainInfo.getPostingDate(),DateUtils.DATE_PATTERN_ANOTHER));
        //货款方式
        res.setLnSty("1");
        //贷款五级分类
        res.setLnFiveStageTyp(five(amLoanAccountInfo.getLoanClassify()));
        //利率依据方式
        res.setIntrAcorSty("01");
        //利率加减符号
        res.setDlayIntrPlmnSymb("+");
        //逾期利率依据方式
        res.setDlayIntrAcorSty("02");
        //逾期利率加减符号
        res.setDlayIntrPlmnSymb("*");
        //逾期利率加减码
        res.setDlayIntrPlmnCod("1.5");
        //违约金收取代码
        res.setFacCod("0");
        //呆账核销标志
        res.setApclFlg("N");
        //贷款余额 loan_total_principal_balance 格式
        res.setLnBal(stoint(amLoanAccountInfo.getRemainPrincipal()));
        //贷款总额
        res.setLnTotlaAmt(stoint(amLoanMainInfo.getLoanAmount()));
        //应收利息 原利息 - 折扣利息
        res.setIntrbl(stoint(amLoanMainInfo.getInterestBeforeDiscount().subtract(amLoanMainInfo.getInterestDiscount())));
        //应收利息复息
        res.setIntrblInt("");
        //逾期复息金额
        res.setDlayIntInt("");
        //催收应收利息
        res.setOvdlnIntrbl("");
        //存款账户
        res.setDepAcctNo(tlDisbursementLog.getPayeeAccount());
        //自动扣款存款账户
        res.setAutoDeduDepAcctNo(bank.getCardNumber());

        //最近本金异动日期
        if(CollectionUtils.isNotEmpty(PaymentAllocationList)){
            res.setLtstPrMvDtN(DateUtils.format(PaymentAllocationList.get(0).getPostingDate(),DateUtils.DATE_PATTERN_ANOTHER));
        }
        //重要账户标志
        res.setVipAcctFlg("");
        if(TransBizConstant.LOAN_STATUS_8.equals(amLoanAccountInfo.getAccountStatus()) ||
                TransBizConstant.LOAN_STATUS_7.equals(amLoanAccountInfo.getAccountStatus())){
            //下次预计还本日期
            res.setNextPrRfnDtN(DateUtils.format(amLoanAccountInfo.getNextPaymentDate(),DateUtils.DATE_PATTERN_ANOTHER));
            //下次预计缴息日期
            res.setNextIntRfnDtN(DateUtils.format(amLoanAccountInfo.getNextPaymentDate(),DateUtils.DATE_PATTERN_ANOTHER));
        }else{
            //下次预计还本日期
            res.setNextPrRfnDtN("");
            //下次预计缴息日期
            res.setNextIntRfnDtN("");
        }
        //借据号
        res.setCnlNo(amLoanMainInfo.getLoanId());
        //证件种类
        res.setCertType("A");
        //证件号
        res.setCertId(firstLevel.getIdNumber());
        //信贷员号（行号）
        res.setOfficerNo("811777777X02");
        //利率种类
        res.setIntrTyp("BB");
        //自动扣款存款账户2
        res.setAutoDeduDepAcctNo2(tlDisbursementLog.getPayeeAccount());
        //客户名称(120位)（客户姓名）
        res.setCustName120(firstLevel.getChineseName());
        //证件号码(60位)（有）
        res.setCertId60(firstLevel.getIdNumber());
        //信贷产品简称（产品名称）
        res.setLnCmisPdpDesc(prProductTable.getChineseName());
        //特殊还款方式
        res.setLnRfnStyFlg("");
        //减免标志
        res.setLnWaveFlg("N");
        //业务暂停标志
        res.setLnHaltSymb("N");

        return res;
    }

    @Override
    public ProductDescRes productDescQuery(ProductDescReq req) throws TxnBizException {
        ProductDescRes res = new ProductDescRes();
        List<ProductRow> productRowList = new ArrayList<>();

        //根据证件号和tenanId查询分路由
        CacheMapping cacheMappingChannel = cacheMappingService.selectCacheByIdNumberAndChannel(req.getTenantId(), req.getIdNumber(),req.getChannel() ,true);
        logger.info("根据证件号[{}]租户[{}]获取路由信息[{}]", req.getIdNumber(), req.getTenantId(), cacheMappingChannel);
        if(null == cacheMappingChannel){
            return null;
        }

        //查询客户信息
        CustomerRes customerRes = customerService.getCustomerByChannelAndUserId(req.getChannel(),cacheMappingChannel.getUserId(),req.getTenantId());
        //根据客户渠道查询客户借据信息
        List<AmLoanMainInfo> loanMainInfoList =
                extAmLoanMainInfoMapper.selectByCusIdtAndTenantId(customerRes.getSecondLevel().getCustomerId(), req.getTenantId());

        if(CollectionUtils.isEmpty(loanMainInfoList)){
            return null;
        }
        //获取默认扣款卡
        CmCustomerBankcardInfo bank = extCmCustomerBankcardInfoMapper.selectBankCardByCondition(
                customerRes.getSecondLevel().getCustomerId(),TransBizConstant.Y_FLAG,null,customerRes.getSecondLevel().getChannel(),req.getTenantId());

        int LoopNum = 1;
        for(AmLoanMainInfo amLoanMainInfo : loanMainInfoList){

            AmLoanAccountInfo amLoanAccountInfo = extAmLoanAccountInfoMapper.selectByLoanId(amLoanMainInfo.getLoanId()
                    ,amLoanMainInfo.getCustomerId(),amLoanMainInfo.getTenantId());

            //获取产品信息
            PrProductTable prProductTable = productTableService.findProByProIdAndOrgId(amLoanMainInfo.getProductId(),amLoanMainInfo.getOrganizationId(),
                    amLoanMainInfo.getTenantId());

            //查询利率参数
            PrInterestTable prInterestTable = interestTableService.findInterestByInterestId(amLoanMainInfo.getInterestTableId(),amLoanMainInfo.getTenantId());

            CmCustomerAddressInfo cmCustomerAddressInfo = new CmCustomerAddressInfo();
            cmCustomerAddressInfo.setAddressStatus(TransBizConstant.YES_FLAG);
            cmCustomerAddressInfo.setAddressType(TransBizConstant.YES_FLAG);
            cmCustomerAddressInfo.setCustomerId(amLoanAccountInfo.getCustomerId());
            cmCustomerAddressInfo.setTenantId(amLoanAccountInfo.getTenantId());
            List<CmCustomerAddressInfo> customerAddressInfos = extCmCustomerAddressInfoMapper.selectByCondSelective(cmCustomerAddressInfo);

            ProductRow ProductDescResponse = new ProductRow();
            ProductDescResponse.setLoopNum(LoopNum + "");
            ProductDescResponse.setpType("G");
            //账号卡号
            ProductDescResponse.setEcAcctNo(bank.getCardNumber());
            //账号类型
            ProductDescResponse.setEcAcctTyp("LN");
            //余额 贷款余额
            ProductDescResponse.setEcAvlAmt1(stoint(amLoanAccountInfo.getRemainPrincipal()));
            //币别
            ProductDescResponse.setEcCurrCod("01");
            //开户机构
            ProductDescResponse.setEcCrtOrg("811777777");
            //储种 存款\贷款种类
            ProductDescResponse.setEcCrtDt("贷款");
            //开户日期 首笔贷款开始日期
            ProductDescResponse.setEcCrtDt(DateUtils.format(amLoanMainInfo.getPostingDate(),DateUtils.DATE_PATTERN_ANOTHER));
            //账户状态
            ProductDescResponse.setEcAcctSts("0");
            //通讯地址
            ProductDescResponse.setEcAcctAddr(customerAddressInfos.get(0).getAddress());
            //邮政编码
            ProductDescResponse.setEcAcctPostcod(customerAddressInfos.get(0).getZipcode());
            //联系电话
            ProductDescResponse.setEcAcctTelNo(customerRes.getSecondLevel().getMobile());
            //产品代码
            ProductDescResponse.setEcAcctPdtCode(prProductTable.getProductId());
            //产品描述
            ProductDescResponse.setEcAcctPdtDes(prProductTable.getChineseName());
            //开户机构名称
            ProductDescResponse.setEcOpunNam("泰安银行");
            //利率
            ProductDescResponse.setEcAcctIntr(rate(prInterestTable.getBaseRate().divide(new BigDecimal(12),8,BigDecimal.ROUND_HALF_UP)));
            //账户状态
            // LN1 正常
            //LN2 逾期
            //LN3 非应计
            //LN5 结清
            //LN6 部分逾期
            //LN9 开户未放款
            ProductDescResponse.setEcAcctSts2(accountStatus(amLoanAccountInfo.getAccountStatus()));

            LoopNum ++;

            productRowList.add(ProductDescResponse);
        }
        res.setProductRowList(productRowList);

        return res;
    }

    @Override
    public WealthOverRes wealthOverQuery(ProductDescReq req) throws TxnBizException {
        WealthOverRes res = new WealthOverRes();

        List<WealthOverRow> wealthOverRowList = new ArrayList<>();

        //根据证件号和tenanId查询分路由
        CacheMapping cacheMappingChannel = cacheMappingService.selectCacheByIdNumberAndChannel(req.getTenantId(), req.getIdNumber() ,req.getChannel() ,true);
        logger.info("根据证件号[{}]租户[{}]获取路由信息[{}]", req.getIdNumber(), req.getTenantId(), cacheMappingChannel);
        if(null == cacheMappingChannel){
            return null;
        }

        //查询客户信息
        CustomerRes customerRes = customerService.getCustomerByChannelAndUserId(req.getChannel(),cacheMappingChannel.getUserId(),req.getTenantId());

        //根据客户渠道查询客户借据信息
        List<AmLoanMainInfo> loanMainInfoList =
                extAmLoanMainInfoMapper.selectByCusIdtAndTenantId(customerRes.getSecondLevel().getCustomerId(), req.getTenantId());

        if(CollectionUtils.isEmpty(loanMainInfoList)){
            return null;
        }

        int i = 1;
        for(AmLoanMainInfo amLoanMainInfo : loanMainInfoList){
            AmLoanAccountInfo amLoanAccountInfo = extAmLoanAccountInfoMapper.selectByLoanId(amLoanMainInfo.getLoanId()
                    ,amLoanMainInfo.getCustomerId(),amLoanMainInfo.getTenantId());

            //获取产品信息
            PrProductTable prProductTable = productTableService.findProByProIdAndOrgId(amLoanMainInfo.getProductId(),amLoanMainInfo.getOrganizationId(),
                    amLoanMainInfo.getTenantId());

            WealthOverRow wealthOverviewResponse = new WealthOverRow();
            wealthOverviewResponse.setLoopNum(i+"");
            wealthOverviewResponse.setpType("G");
            //序号
            wealthOverviewResponse.setCntNo(i+"");
            //类型
            wealthOverviewResponse.setAgtTyp(req.getType());
            //子类型
            wealthOverviewResponse.setAgtSubtyp("贷款");
            //账号合同
            wealthOverviewResponse.setAgtNo(amLoanMainInfo.getLoanId());
            //产品代码
            wealthOverviewResponse.setPdtCod(prProductTable.getProductId());
            //产品名称
            wealthOverviewResponse.setPdtNam(prProductTable.getChineseName());
            //币种
            wealthOverviewResponse.setCurrCod("01");
            //状态
            wealthOverviewResponse.setAgtSts("");
            //凭证类别
            wealthOverviewResponse.setDocTyp("");
            //凭证号码
            wealthOverviewResponse.setPsbkPrtNo1("");
            //存款种类
            wealthOverviewResponse.setDepTyp("");
            //期限码
            wealthOverviewResponse.setDepPrd("");
            //余额 贷款余额
            wealthOverviewResponse.setBal(stoint(amLoanAccountInfo.getRemainPrincipal()));
            //主附卡
            wealthOverviewResponse.setMnsubDrp("");
            //客户名称
            wealthOverviewResponse.setCustName(customerRes.getFirstLevel().getChineseName());
            //贷款种类
            wealthOverviewResponse.setLnTyp("182");
            //贷款金额
            wealthOverviewResponse.setTotlLnAmtHypoAmt(stoint(amLoanMainInfo.getLoanAmount()));
            //账户性质
            wealthOverviewResponse.setAcctChar("");
            //开户机构
            wealthOverviewResponse.setAgtOpenOrg("");
            //开户日期
            wealthOverviewResponse.setAgtOpenDt(DateUtils.formatDate(amLoanMainInfo.getPostingDate(), DateUtils.DATE_PATTERN_ANOTHER));
            //服务代码
            wealthOverviewResponse.setEcServiceId("");
            //客户名称-120
            wealthOverviewResponse.setCustName120(customerRes.getFirstLevel().getChineseName());

            wealthOverRowList.add(wealthOverviewResponse);

        }
        res.setWealthOverRowList(wealthOverRowList);

        return res;
    }


    private String account(String stu){
        //SPACE:开户
        //1:正常
        //2:逾期
        //3:非应计
        //5:结清
        //6:部分正常
        String rtu="";
        if(TransBizConstant.LOAN_STATUS_0.equals(stu)|| TransBizConstant.LOAN_STATUS_1.equals(stu)){
            rtu="1";
        }
        if(TransBizConstant.LOAN_STATUS_7.equals(stu)|| TransBizConstant.LOAN_STATUS_8.equals(stu)){
            rtu="5";
        }
        if(TransBizConstant.LOAN_STATUS_2.equals(stu)){
            rtu="2";
        }
        return rtu;
    }

    //转化为千分利率
    private String rate(BigDecimal bigDecimal){
        if(bigDecimal.compareTo(BigDecimal.ZERO)==0){
            return "00000000";
        }else {
            String num= bigDecimal.multiply(new BigDecimal(1000)).setScale(4,BigDecimal.ROUND_DOWN).toString();
            return String.format("%08d",Integer.parseInt(num.replace(".","")));
        }
    }

    private String paymet(String stu){
        //还款方式 01:期初付息,到期还本//02:期末本息一次付清//03:定期结息,到期还本//04:定期结息,按还款计划还本//13:等额本息还款//14:等额本金还款
        String rtu="";
        if("02".equals(stu)){
            rtu="13";
        }
        if("08".equals(stu)){
            rtu="14";
        }
        return rtu;
    }

    private String five(String fiveLv){
        switch (fiveLv){
            case TransBizConstant.LOAN_CLASSIFY_0:
                return "01";
            case TransBizConstant.LOAN_CLASSIFY_1:
                return "02";
            case TransBizConstant.LOAN_CLASSIFY_2:
                return "03";
            case TransBizConstant.LOAN_CLASSIFY_3:
                return "04";
            case TransBizConstant.LOAN_CLASSIFY_4:
                return "05";
            default :
                return "";
        }
    }

    //转化为分 格式化数字 生成15 不够补0
    private String stoint(BigDecimal rtu){
        if(rtu.compareTo(BigDecimal.ZERO)==0){
            return "000000000000000";
        }else {
            return String.format("%015d",rtu.multiply(new BigDecimal(100)).intValue());
        }

    }

    private String accountStatus(String stu) {
        // LN1 正常
        //LN2 逾期
        //LN3 非应计
        //LN5 结清
        //LN6 部分逾期
        //LN9 开户未放款
        String rtu = "";
        if (TransBizConstant.ACCOUNT_STATUS_0.equals(stu) || TransBizConstant.ACCOUNT_STATUS_1.equals(stu)) {
            rtu = "LN1";
        }
        if (TransBizConstant.ACCOUNT_STATUS_7.equals(stu) || TransBizConstant.ACCOUNT_STATUS_8.equals(stu)) {
            rtu = "LN5";
        }
        if (TransBizConstant.ACCOUNT_STATUS_2.equals(stu)) {
            rtu = "LN2";
        }
        return rtu;
    }
}
